﻿@inject IStringLocalizer<CascaderDisabled> Localizer

<div class="row g-3">
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Primary" />
    </div>
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Success" />
    </div>
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Danger" />
    </div>
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Warning" />
    </div>
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Info" />
    </div>
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Secondary" />
    </div>
    <div class="col-12 col-sm-6">
        <Cascader TValue="string" Items="@_items" IsDisabled="true" Color="Color.Dark" />
    </div>
</div>

@code {
    private List<CascaderItem> _items = new List<CascaderItem>();

    /// <summary>
    /// OnInitialized
    /// </summary>
    protected override void OnInitialized()
    {
        _items = new List<CascaderItem>
        {
            new CascaderItem(Localizer["item1"], Localizer["item1"]),
            new CascaderItem(Localizer["item2"], Localizer["item2"]),
            new CascaderItem(Localizer["item3"], Localizer["item3"]),
        };

        _items[0].AddItem(new CascaderItem("item1_child1", Localizer["item1_child1"]));
        _items[0].AddItem(new CascaderItem("item1_child2", Localizer["item1_child2"]));
        _items[0].AddItem(new CascaderItem("item1_child3", Localizer["item1_child3"]));
        _items[0].AddItem(new CascaderItem("item1_child4", Localizer["item1_child4"]));

        _items[0].Items.ElementAt(0).AddItem(new CascaderItem("item1_child1_child", Localizer["item1_child1_child"]));

        _items[1].AddItem(new CascaderItem("item2_child1", Localizer["item2_child1"]));
        _items[1].AddItem(new CascaderItem("item2_child2", Localizer["item2_child2"]));
        _items[1].AddItem(new CascaderItem("item2_child3", Localizer["item2_child3"]));

        _items[2].AddItem(new CascaderItem("item3_child1", Localizer["item3_child1"]));
        _items[2].AddItem(new CascaderItem("item3_child2", Localizer["item3_child2"]));
    }
}
